import sys

def build(bld):
    libs = 'SCRIPT EXTENSION THREAD RESOURCE DDF DLIB PROFILE_NULL LUA SCRIPT crashext'

    if bld.env.IS_TARGET_DESKTOP:

        is64Bit = '64' in bld.env.PLATFORM
        crashtool = bld.program(features = 'cxx',
                                includes = '..',
                                use      = libs,
                                target   = 'crashtool' + ('_64' if is64Bit else '_32'),
                                source   = bld.path.ant_glob('crashtool.cpp'))

        if sys.platform == 'win32':
            crashtool.env.append_value('LINKFLAGS', ['Dbghelp.lib', 'psapi.lib'])
